#### ibatis2mybatis_dao.sh
# 把getSqlMapClientTemplate()改成sqlSessionTemplate
find . -name "*\.java" | xargs perl -pi -e 's|getSqlMapClientTemplate\(\)|sqlSessionTemplate|g'

# 方法名称一一对应改掉，queryForObject——>selectOne，queryForList——>selectList
find . -name "*DAO\.java" | xargs perl -pi -e 's|queryForObject|selectOne|g'

find . -name "*DAO\.java" | xargs perl -pi -e 's|queryForList|selectList|g'

find . -name "*DAO\.java" | xargs perl -pi -e 's|return[\s]*sqlSessionTemplate [\s]*\.selectList|return sqlSessionTemplate\.selectList|g'

# 去掉不再使用的AutowiringSqlMapClientDaoSupport辅助类
find . -name "*DAO\.java" | xargs perl -pi -e 's|import com\.tmall\.wireless\.fun\.core\.utils\.AutowiringSqlMapClientDaoSupport;||g'

find . -name "*DAO\.java" | xargs perl -pi -e 's| extends AutowiringSqlMapClientDaoSupport||g'

find . -name "*DAO\.java" | xargs sed -i '' '/@SuppressWarnings/d'

# 添加新的SqlSessionTemplate注入
find . -name "*DAO\.java" | xargs sed -i '' '/public class/a\
@Resource'

find . -name "*DAO\.java" | xargs sed -i '' '/@Resource/G'

find . -name "*DAO\.java" | xargs sed -i '' '/@Resource/a\
private SqlSessionTemplate sqlSessionTemplate;'

find . -name "*DAO\.java" | xargs sed -i '' '/public class/G'
find . -name "*DAO\.java" | xargs sed -i '' 's/^@Resource/    @Resource/'
find . -name "*DAO\.java" | xargs sed -i '' 's/^private/    private^/'